package com.kucai.yifaqapp.presenter.activity;

import com.kucai.yifaqapp.model.CustomObserver;
import com.kucai.yifaqapp.model.network.HttpJsonUtils;
import com.kucai.yifaqapp.model.network.entity.res.ResLong;
import com.kucai.yifaqapp.ui.activity.LongsidesActivity;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2018/12/4.
 */

public class LongsidesActivityPesenter extends BaseActivityPresenter<LongsidesActivity> {
    public LongsidesActivityPesenter(LongsidesActivity mActivity) {
        super(mActivity);
    }

    public void getlong(String url) {
        HttpJsonUtils.getHttpApiInstance()
                .getlong(url)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new CustomObserver<ResLong>(mActivity) {
                    @Override
                    protected void onSubscribeCustom(Disposable disposable) {
                    }

                    @Override
                    protected void onErrorCustom(Throwable e) {

                    }

                    @Override
                    protected void onCustomNext(ResLong resNote) {
                        mActivity.getlog(resNote);

                    }
                });
    }
}